home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MacGofer 0.22d / MacGofer 0.22d Release / Gofer Documentation / Gofer Manual / appx_a next >
Text File  |  1991-12-30  |  10KB  |  104 lines

  1. h lower case letter as described in
  2.            section 6.
  3.   CONID    like VARID, but beginning with upper case letter.
  4.   VAROP    operator symbol not beginning with a colon, as described in
  5.            section 6.
  6.   CONOP    constructor function operator, like VAROP, but beginning
  7.            with a colon character.
  8.   INTEGER  integer constant, as described in section 7.3.
  9.   FLOAT    floating point constant, as described in section 7.4.
  10.   CHAR     character constant, as described in section 7.5.
  11.   STRING   string constant, as described in section 7.7.
  12.  
  13.  
  14. Top-level grammar
  15. -----------------
  16.  
  17.     <module>   ::= "{" <topdecls> "}"               module
  18.  
  19.     <interp>   ::= <exp> [<where>]                  top-level expression
  20.  
  21.     <topdecls> ::= <topdecls>; <topdecls>           multiple declarations
  22.                 |  data <typeLhs> = <constrs>       datatype declaration
  23.                 |  type <typeLhs> = <type>          synonym declaration
  24.                 |  infixl [<digit>] <op> {, <op>}   fixity declarations
  25.                 |  infixr [<digit>] <op> {, <op>}
  26.                 |  infix  [<digit>] <op> {, <op>}
  27.                 |  primitive <prims> :: <type>      primitive bindings
  28.                 |  <class>                          class declaration
  29.                 |  <inst>                           instance declaration
  30.                 |  <decls>                          value declarations
  31.  
  32.  
  33.                                       93
  34.  
  35.  
  36.  
  37.  
  38. Introduction to Gofer         APPENDIX A: SUMMARY OF GRAMMAR                    
  39.  
  40.  
  41.     <typeLhs>  ::= CONID {VARID}                    type declaration lhs
  42.  
  43.     <constrs>  ::= <constrs> "|" <constrs>          multiple constructors
  44.                 |  <type> CONOP <type>              infix constructor
  45.                 |  CONID {<type>}                   constructor, n>=0
  46.  
  47.     <prims>    ::= <prims>, <prims>                 multiple bindings
  48.                 |  <var> <string>                   primitive binding
  49.  
  50. Type expressions
  51. ----------------
  52.  
  53.     <sigType>  ::= [<context> => ] <type>           [qualified] type
  54.  
  55.     <context>  ::= "(" [<pred> {, <pred>}] ")"      general form
  56.                 |  <pred>                           singleton context
  57.     <pred>     ::= CONID <type> {<type>}            predicate
  58.  
  59.     <type>     ::= <ctype> [ -> <type> ]            function type
  60.     <ctype>    ::= CONID {<atype>}                  datatype or synonym
  61.                 |  <atype>
  62.     <atype>    ::= VARID                            type variable
  63.                 |  "(" ")"                          unit type
  64.                 |  "(" <type> ")"                   parenthesised type
  65.                 |  "(" <type>,<type> {,<type>} ")"  tuple type
  66.                 |  "[" <type> "]"                   list type
  67.  
  68. Class and instance declarations
  69. -------------------------------
  70.  
  71.     <class>    ::= class [<context> =>] <pred> [<cbody>]
  72.     <cbody>    ::= where "{" <cdecls> "}"           class body
  73.     <cdecls>   ::= <cdecls>; <cdecls>               multiple declarations
  74.                 |  <var> {, <var>} :: <type>        member functions
  75.                 |  <fun> <rhs> [<where>]            default bindings
  76.  
  77.     <inst>     ::= inst  [<context> =>] <pred> [<ibody>]
  78.     <ibody>    ::= where "{" <idecls> "}"           instance body
  79.     <idecls>   ::= <idecls>; <idecls>               multiple declarations
  80.                 |  <fun> <rhs> [<where>]            member definition
  81.  
  82. Value declarations
  83. ------------------
  84.  
  85.     <decls>  ::= <decls>; <decls>                 multiple declarations
  86.               |  <var> {, <var>} :: <sigType>     type declaration
  87.               |  <fun> <rhs> [<where>]            function binding
  88.               |  <pat> <rhs> [<where>]            pattern binding
  89.  
  90.     <rhs>    ::= = <exp>                          simple right hand side
  91.               |  <gdRhs> {<gdRhs>}                guarded right hand sides
  92.  
  93.     <gdRhs>  ::= "|" <exp> = <exp>                guarded right hand side
  94.  
  95.     <where>  ::= where "{" <decls> "}"            local definitions
  96.  
  97.  
  98.  
  99.                                       94
  100.  
  101.  
  102.  
  103.  
  104. Introduction to Gofer